/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('buss', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model BusinessResultServiceRequest {
  actionCode?: string(name='ActionCode'),
  bussinessCode?: string(name='BussinessCode'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  result?: map[string]any(name='Result'),
  success?: boolean(name='Success'),
}

model BusinessResultServiceShrinkRequest {
  actionCode?: string(name='ActionCode'),
  bussinessCode?: string(name='BussinessCode'),
  errCode?: string(name='ErrCode'),
  errMessage?: string(name='ErrMessage'),
  requestId?: string(name='RequestId'),
  resultShrink?: string(name='Result'),
  success?: boolean(name='Success'),
}

model BusinessResultServiceResponseBody = {
  code?: string(name='Code'),
  count?: int32(name='Count'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  success?: boolean(name='Success'),
}

model BusinessResultServiceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: BusinessResultServiceResponseBody(name='body'),
}

/**
 * @summary 处罚请求异步接口回调
 *
 * @param tmpReq BusinessResultServiceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return BusinessResultServiceResponse
 */
async function businessResultServiceWithOptions(tmpReq: BusinessResultServiceRequest, runtime: $RuntimeOptions): BusinessResultServiceResponse {
  tmpReq.validate();
  var request = new BusinessResultServiceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.result)) {
    request.resultShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.result, 'Result', 'json');
  }
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'BusinessResultService',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 处罚请求异步接口回调
 *
 * @param request BusinessResultServiceRequest
 * @return BusinessResultServiceResponse
 */
async function businessResultService(request: BusinessResultServiceRequest): BusinessResultServiceResponse {
  var runtime = new $RuntimeOptions{};
  return businessResultServiceWithOptions(request, runtime);
}

model CreateUserInvestigationInfoQueryTaskRequest {
  dataType?: string(name='dataType', description='This parameter is required.'),
  employeeId?: string(name='employeeId', description='This parameter is required.'),
  endTime?: long(name='endTime', description='This parameter is required.'),
  ossFileName?: string(name='ossFileName', description='This parameter is required.'),
  startTime?: long(name='startTime', description='This parameter is required.'),
  userId?: string(name='userId', description='This parameter is required.'),
}

model CreateUserInvestigationInfoQueryTaskResponseBody = {
  code?: string(name='Code'),
  data?: {
    taskId?: string(name='taskId'),
  }(name='Data'),
  message?: string(name='Message'),
  success?: boolean(name='Success'),
}

model CreateUserInvestigationInfoQueryTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateUserInvestigationInfoQueryTaskResponseBody(name='body'),
}

/**
 * @summary 协查中心查询任务接口
 *
 * @param request CreateUserInvestigationInfoQueryTaskRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateUserInvestigationInfoQueryTaskResponse
 */
async function createUserInvestigationInfoQueryTaskWithOptions(request: CreateUserInvestigationInfoQueryTaskRequest, runtime: $RuntimeOptions): CreateUserInvestigationInfoQueryTaskResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateUserInvestigationInfoQueryTask',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 协查中心查询任务接口
 *
 * @param request CreateUserInvestigationInfoQueryTaskRequest
 * @return CreateUserInvestigationInfoQueryTaskResponse
 */
async function createUserInvestigationInfoQueryTask(request: CreateUserInvestigationInfoQueryTaskRequest): CreateUserInvestigationInfoQueryTaskResponse {
  var runtime = new $RuntimeOptions{};
  return createUserInvestigationInfoQueryTaskWithOptions(request, runtime);
}

model FindInstanceInfoRequest {
  businessCodes?: string(name='businessCodes'),
  bussinessCode?: string(name='bussinessCode'),
  domain?: string(name='domain'),
  endTime?: long(name='endTime'),
  extras?: map[string]any(name='extras'),
  ip?: string(name='ip'),
  needDNS?: boolean(name='needDNS'),
  startTime?: long(name='startTime'),
  url?: string(name='url'),
  userId?: string(name='userId'),
}

model FindInstanceInfoShrinkRequest {
  businessCodes?: string(name='businessCodes'),
  bussinessCode?: string(name='bussinessCode'),
  domain?: string(name='domain'),
  endTime?: long(name='endTime'),
  extrasShrink?: string(name='extras'),
  ip?: string(name='ip'),
  needDNS?: boolean(name='needDNS'),
  startTime?: long(name='startTime'),
  url?: string(name='url'),
  userId?: string(name='userId'),
}

model FindInstanceInfoResponseBody = {
  code?: string(name='Code'),
  count?: int32(name='Count'),
  data?: {
    pegInstanceInfoList?: [ 
      {
        bussinessCode?: string(name='BussinessCode'),
        coordinate?: map[string]any(name='Coordinate'),
        idType?: string(name='IdType'),
        instanceId?: string(name='InstanceId'),
        serviceCreatedTime?: string(name='ServiceCreatedTime'),
        userId?: string(name='UserId'),
        userInfo?: {
          gcLevel?: string(name='GcLevel'),
          hitWhiteReason?: string(name='HitWhiteReason'),
          userId?: string(name='UserId'),
          userSite?: string(name='UserSite'),
          whiteUser?: boolean(name='WhiteUser'),
        }(name='UserInfo'),
      }
    ](name='PegInstanceInfoList'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model FindInstanceInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: FindInstanceInfoResponseBody(name='body'),
}

/**
 * @summary 反查资源
 *
 * @param tmpReq FindInstanceInfoRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return FindInstanceInfoResponse
 */
async function findInstanceInfoWithOptions(tmpReq: FindInstanceInfoRequest, runtime: $RuntimeOptions): FindInstanceInfoResponse {
  tmpReq.validate();
  var request = new FindInstanceInfoShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.extras)) {
    request.extrasShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.extras, 'extras', 'json');
  }
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'FindInstanceInfo',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 反查资源
 *
 * @param request FindInstanceInfoRequest
 * @return FindInstanceInfoResponse
 */
async function findInstanceInfo(request: FindInstanceInfoRequest): FindInstanceInfoResponse {
  var runtime = new $RuntimeOptions{};
  return findInstanceInfoWithOptions(request, runtime);
}

model FindUserAvailbleResourcesRequest {
  bussinessCode?: string(name='bussinessCode'),
  currPage?: int32(name='currPage'),
  pageSize?: int32(name='pageSize'),
  resourceType?: string(name='resourceType'),
  userId?: string(name='userId'),
}

model FindUserAvailbleResourcesResponseBody = {
  code?: string(name='Code'),
  count?: long(name='Count'),
  data?: {
    pegCoordinates?: [ 
      {
        bussinessCode?: string(name='BussinessCode'),
        chargeType?: string(name='ChargeType'),
        coordinate?: map[string]any(name='Coordinate'),
        idType?: string(name='IdType'),
        instanceId?: string(name='InstanceId'),
        region?: string(name='Region'),
        releaseTime?: string(name='ReleaseTime'),
        resCreateTime?: string(name='ResCreateTime'),
        resourceStatus?: string(name='ResourceStatus'),
        resourceType?: string(name='ResourceType'),
        serviceCreatedTime?: string(name='ServiceCreatedTime'),
        userId?: string(name='UserId'),
      }
    ](name='PegCoordinates'),
    userInfo?: {
      gcLevel?: string(name='GcLevel'),
      hitWhiteReason?: string(name='HitWhiteReason'),
      userId?: string(name='UserId'),
      userSite?: string(name='UserSite'),
      whiteUser?: boolean(name='WhiteUser'),
    }(name='UserInfo'),
  }(name='Data'),
  maxResults?: int32(name='MaxResults'),
  message?: string(name='Message'),
  nextToken?: string(name='NextToken', description='This parameter is required.'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalCount?: int32(name='TotalCount'),
}

model FindUserAvailbleResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: FindUserAvailbleResourcesResponseBody(name='body'),
}

/**
 * @summary 根据用户id查询对应产品下全部可用资产信息接口
 *
 * @param request FindUserAvailbleResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return FindUserAvailbleResourcesResponse
 */
async function findUserAvailbleResourcesWithOptions(request: FindUserAvailbleResourcesRequest, runtime: $RuntimeOptions): FindUserAvailbleResourcesResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'FindUserAvailbleResources',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 根据用户id查询对应产品下全部可用资产信息接口
 *
 * @param request FindUserAvailbleResourcesRequest
 * @return FindUserAvailbleResourcesResponse
 */
async function findUserAvailbleResources(request: FindUserAvailbleResourcesRequest): FindUserAvailbleResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return findUserAvailbleResourcesWithOptions(request, runtime);
}

model GetSecurityEventDetailRequest {
  aliUid?: string(name='AliUid'),
  eventId?: string(name='EventId'),
  callerParentId?: long(name='callerParentId'),
  callerType?: string(name='callerType'),
  callerUid?: long(name='callerUid'),
}

model GetSecurityEventDetailResponseBody = {
  code?: string(name='Code'),
  data?: {
    aliuid?: string(name='Aliuid'),
    dataSource?: string(name='DataSource'),
    eventCode?: string(name='EventCode'),
    eventId?: string(name='EventId'),
    eventTime?: string(name='EventTime'),
    extra?: string(name='Extra'),
    level?: string(name='Level'),
    principalId?: string(name='PrincipalId'),
    resourceId?: string(name='ResourceId'),
    status?: string(name='Status'),
    type?: string(name='Type'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model GetSecurityEventDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSecurityEventDetailResponseBody(name='body'),
}

/**
 * @summary 查询安全事件详情
 *
 * @param request GetSecurityEventDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSecurityEventDetailResponse
 */
async function getSecurityEventDetailWithOptions(request: GetSecurityEventDetailRequest, runtime: $RuntimeOptions): GetSecurityEventDetailResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'GetSecurityEventDetail',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询安全事件详情
 *
 * @param request GetSecurityEventDetailRequest
 * @return GetSecurityEventDetailResponse
 */
async function getSecurityEventDetail(request: GetSecurityEventDetailRequest): GetSecurityEventDetailResponse {
  var runtime = new $RuntimeOptions{};
  return getSecurityEventDetailWithOptions(request, runtime);
}

model PunishResourceSearchRequest {
  actionCodes?: [ string ](name='ActionCodes'),
  bussinessCodes?: [ string ](name='BussinessCodes'),
  class?: string(name='Class'),
  domain?: string(name='Domain'),
  endDate?: long(name='EndDate'),
  instanceId?: string(name='InstanceId'),
  ip?: string(name='Ip'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
  sourceCodes?: [ string ](name='SourceCodes'),
  startDate?: long(name='StartDate'),
  status?: string(name='Status'),
  url?: string(name='Url'),
  userIds?: [ string ](name='UserIds'),
}

model PunishResourceSearchShrinkRequest {
  actionCodesShrink?: string(name='ActionCodes'),
  bussinessCodesShrink?: string(name='BussinessCodes'),
  class?: string(name='Class'),
  domain?: string(name='Domain'),
  endDate?: long(name='EndDate'),
  instanceId?: string(name='InstanceId'),
  ip?: string(name='Ip'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
  sourceCodesShrink?: string(name='SourceCodes'),
  startDate?: long(name='StartDate'),
  status?: string(name='Status'),
  url?: string(name='Url'),
  userIdsShrink?: string(name='UserIds'),
}

model PunishResourceSearchResponseBody = {
  code?: string(name='Code'),
  dataList?: [ 
    {
      actionCode?: string(name='ActionCode'),
      bussinessCode?: string(name='BussinessCode'),
      class?: string(name='Class'),
      coordinate?: string(name='Coordinate'),
      creator?: string(name='Creator'),
      deleted?: boolean(name='Deleted'),
      domain?: string(name='Domain'),
      extras?: string(name='Extras'),
      gmtCreated?: string(name='GmtCreated'),
      gmtModified?: string(name='GmtModified'),
      id?: long(name='Id'),
      instanceId?: string(name='InstanceId'),
      ip?: string(name='Ip'),
      modifier?: string(name='Modifier'),
      objectId?: string(name='ObjectId'),
      objectType?: string(name='ObjectType'),
      objectValue?: string(name='ObjectValue'),
      punishFrom?: string(name='PunishFrom'),
      reason?: string(name='Reason'),
      requestId?: long(name='RequestId'),
      sourceCode?: string(name='SourceCode'),
      status?: string(name='Status'),
      url?: string(name='Url'),
      userId?: string(name='UserId'),
    }
  ](name='DataList'),
  message?: string(name='Message'),
  success?: string(name='Success'),
  totalCount?: int32(name='TotalCount'),
  viewCount?: int32(name='ViewCount'),
}

model PunishResourceSearchResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PunishResourceSearchResponseBody(name='body'),
}

/**
 * @summary 处罚资源搜索
 *
 * @param tmpReq PunishResourceSearchRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return PunishResourceSearchResponse
 */
async function punishResourceSearchWithOptions(tmpReq: PunishResourceSearchRequest, runtime: $RuntimeOptions): PunishResourceSearchResponse {
  tmpReq.validate();
  var request = new PunishResourceSearchShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.actionCodes)) {
    request.actionCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.actionCodes, 'ActionCodes', 'json');
  }
  if (!$isNull(tmpReq.bussinessCodes)) {
    request.bussinessCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.bussinessCodes, 'BussinessCodes', 'json');
  }
  if (!$isNull(tmpReq.sourceCodes)) {
    request.sourceCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sourceCodes, 'SourceCodes', 'json');
  }
  if (!$isNull(tmpReq.userIds)) {
    request.userIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.userIds, 'UserIds', 'json');
  }
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'PunishResourceSearch',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 处罚资源搜索
 *
 * @param request PunishResourceSearchRequest
 * @return PunishResourceSearchResponse
 */
async function punishResourceSearch(request: PunishResourceSearchRequest): PunishResourceSearchResponse {
  var runtime = new $RuntimeOptions{};
  return punishResourceSearchWithOptions(request, runtime);
}

model RecordClickLinkActionRequest {
  tag?: string(name='Tag'),
}

model RecordClickLinkActionResponseBody = {
  code?: string(name='Code'),
  count?: int32(name='Count'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model RecordClickLinkActionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RecordClickLinkActionResponseBody(name='body'),
}

/**
 * @summary 记录是否点击链接
 *
 * @param request RecordClickLinkActionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RecordClickLinkActionResponse
 */
async function recordClickLinkActionWithOptions(request: RecordClickLinkActionRequest, runtime: $RuntimeOptions): RecordClickLinkActionResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.tag)) {
    body['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'RecordClickLinkAction',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 记录是否点击链接
 *
 * @param request RecordClickLinkActionRequest
 * @return RecordClickLinkActionResponse
 */
async function recordClickLinkAction(request: RecordClickLinkActionRequest): RecordClickLinkActionResponse {
  var runtime = new $RuntimeOptions{};
  return recordClickLinkActionWithOptions(request, runtime);
}

model RiskEventSyncRequest {
  deleted?: boolean(name='Deleted'),
  discoveryTime?: long(name='DiscoveryTime', description='This parameter is required.'),
  eventName?: string(name='EventName', description='This parameter is required.'),
  eventNumber?: string(name='EventNumber'),
  relevanceBu?: string(name='RelevanceBu'),
  riskDetail?: string(name='RiskDetail', description='This parameter is required.'),
  riskEffectType?: string(name='RiskEffectType', description='This parameter is required.'),
  riskLevel?: string(name='RiskLevel'),
  riskType?: string(name='RiskType', description='This parameter is required.'),
  source?: string(name='Source', description='This parameter is required.'),
  submitter?: string(name='Submitter', description='This parameter is required.'),
}

model RiskEventSyncResponseBody = {
  code?: string(name='Code'),
  count?: int32(name='Count'),
  data?: string(name='Data'),
  message?: string(name='Message'),
  success?: boolean(name='Success'),
}

model RiskEventSyncResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RiskEventSyncResponseBody(name='body'),
}

/**
 * @summary 风险事件同步
 *
 * @param request RiskEventSyncRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return RiskEventSyncResponse
 */
async function riskEventSyncWithOptions(request: RiskEventSyncRequest, runtime: $RuntimeOptions): RiskEventSyncResponse {
  request.validate();
  var body : map[string]any = {};
  if (!$isNull(request.deleted)) {
    body['Deleted'] = request.deleted;
  }
  if (!$isNull(request.discoveryTime)) {
    body['DiscoveryTime'] = request.discoveryTime;
  }
  if (!$isNull(request.eventName)) {
    body['EventName'] = request.eventName;
  }
  if (!$isNull(request.eventNumber)) {
    body['EventNumber'] = request.eventNumber;
  }
  if (!$isNull(request.relevanceBu)) {
    body['RelevanceBu'] = request.relevanceBu;
  }
  if (!$isNull(request.riskDetail)) {
    body['RiskDetail'] = request.riskDetail;
  }
  if (!$isNull(request.riskEffectType)) {
    body['RiskEffectType'] = request.riskEffectType;
  }
  if (!$isNull(request.riskLevel)) {
    body['RiskLevel'] = request.riskLevel;
  }
  if (!$isNull(request.riskType)) {
    body['RiskType'] = request.riskType;
  }
  if (!$isNull(request.source)) {
    body['Source'] = request.source;
  }
  if (!$isNull(request.submitter)) {
    body['Submitter'] = request.submitter;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'RiskEventSync',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 风险事件同步
 *
 * @param request RiskEventSyncRequest
 * @return RiskEventSyncResponse
 */
async function riskEventSync(request: RiskEventSyncRequest): RiskEventSyncResponse {
  var runtime = new $RuntimeOptions{};
  return riskEventSyncWithOptions(request, runtime);
}

model SearchPunishEventsRequest {
  aliUid?: string(name='AliUid', description='This parameter is required.'),
  bussinessCodes?: [ string ](name='BussinessCodes'),
  caseCodes?: [ string ](name='CaseCodes'),
  eventCodes?: [ string ](name='EventCodes'),
  resourceId?: string(name='ResourceId'),
}

model SearchPunishEventsShrinkRequest {
  aliUid?: string(name='AliUid', description='This parameter is required.'),
  bussinessCodesShrink?: string(name='BussinessCodes'),
  caseCodesShrink?: string(name='CaseCodes'),
  eventCodesShrink?: string(name='EventCodes'),
  resourceId?: string(name='ResourceId'),
}

model SearchPunishEventsResponseBody = {
  code?: string(name='Code'),
  dataList?: [ 
    {
      bussinessCode?: string(name='BussinessCode'),
      caseCode?: string(name='CaseCode'),
      recordsCount?: int32(name='RecordsCount'),
      resourceId?: string(name='ResourceId'),
      tipsCode?: string(name='TipsCode'),
      userId?: string(name='UserId'),
    }
  ](name='DataList'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  totalCount?: int32(name='TotalCount'),
}

model SearchPunishEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SearchPunishEventsResponseBody(name='body'),
}

/**
 * @summary 管控事件查询
 *
 * @param tmpReq SearchPunishEventsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SearchPunishEventsResponse
 */
async function searchPunishEventsWithOptions(tmpReq: SearchPunishEventsRequest, runtime: $RuntimeOptions): SearchPunishEventsResponse {
  tmpReq.validate();
  var request = new SearchPunishEventsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.bussinessCodes)) {
    request.bussinessCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.bussinessCodes, 'BussinessCodes', 'json');
  }
  if (!$isNull(tmpReq.caseCodes)) {
    request.caseCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.caseCodes, 'CaseCodes', 'json');
  }
  if (!$isNull(tmpReq.eventCodes)) {
    request.eventCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.eventCodes, 'EventCodes', 'json');
  }
  var query = {};
  if (!$isNull(request.aliUid)) {
    query['AliUid'] = request.aliUid;
  }
  if (!$isNull(request.bussinessCodesShrink)) {
    query['BussinessCodes'] = request.bussinessCodesShrink;
  }
  if (!$isNull(request.caseCodesShrink)) {
    query['CaseCodes'] = request.caseCodesShrink;
  }
  if (!$isNull(request.eventCodesShrink)) {
    query['EventCodes'] = request.eventCodesShrink;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SearchPunishEvents',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 管控事件查询
 *
 * @param request SearchPunishEventsRequest
 * @return SearchPunishEventsResponse
 */
async function searchPunishEvents(request: SearchPunishEventsRequest): SearchPunishEventsResponse {
  var runtime = new $RuntimeOptions{};
  return searchPunishEventsWithOptions(request, runtime);
}

model SearchPunishRecordsRequest {
  actionCodes?: [ string ](name='ActionCodes'),
  aliUid?: string(name='AliUid', description='This parameter is required.'),
  bussinessCodes?: string(name='BussinessCodes'),
  caseCodes?: [ string ](name='CaseCodes'),
  domain?: string(name='Domain'),
  endTime?: long(name='EndTime'),
  eventCodes?: [ string ](name='EventCodes'),
  ip?: string(name='Ip'),
  page?: string(name='Page'),
  pageSize?: string(name='PageSize'),
  punishStatus?: [ string ](name='PunishStatus'),
  resourceId?: string(name='ResourceId'),
  sourceCodes?: [ string ](name='SourceCodes'),
  startTime?: long(name='StartTime'),
  url?: string(name='Url'),
  urlFuzzy?: string(name='UrlFuzzy'),
}

model SearchPunishRecordsShrinkRequest {
  actionCodesShrink?: string(name='ActionCodes'),
  aliUid?: string(name='AliUid', description='This parameter is required.'),
  bussinessCodes?: string(name='BussinessCodes'),
  caseCodesShrink?: string(name='CaseCodes'),
  domain?: string(name='Domain'),
  endTime?: long(name='EndTime'),
  eventCodesShrink?: string(name='EventCodes'),
  ip?: string(name='Ip'),
  page?: string(name='Page'),
  pageSize?: string(name='PageSize'),
  punishStatusShrink?: string(name='PunishStatus'),
  resourceId?: string(name='ResourceId'),
  sourceCodesShrink?: string(name='SourceCodes'),
  startTime?: long(name='StartTime'),
  url?: string(name='Url'),
  urlFuzzy?: string(name='UrlFuzzy'),
}

model SearchPunishRecordsResponseBody = {
  code?: string(name='Code'),
  dataList?: [ 
    {
      actionCode?: string(name='ActionCode'),
      antiStatus?: string(name='AntiStatus'),
      bussinessCode?: string(name='BussinessCode'),
      caseCode?: string(name='CaseCode'),
      createTime?: string(name='CreateTime'),
      domain?: string(name='Domain'),
      eventCode?: string(name='EventCode'),
      ip?: string(name='Ip'),
      punishStatus?: string(name='PunishStatus'),
      reason?: string(name='Reason'),
      resourceId?: string(name='ResourceId'),
      tipsCode?: string(name='TipsCode'),
      url?: string(name='Url'),
    }
  ](name='DataList'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
  totalCount?: int32(name='TotalCount'),
}

model SearchPunishRecordsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SearchPunishRecordsResponseBody(name='body'),
}

/**
 * @summary 管控事件查询
 *
 * @param tmpReq SearchPunishRecordsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SearchPunishRecordsResponse
 */
async function searchPunishRecordsWithOptions(tmpReq: SearchPunishRecordsRequest, runtime: $RuntimeOptions): SearchPunishRecordsResponse {
  tmpReq.validate();
  var request = new SearchPunishRecordsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.actionCodes)) {
    request.actionCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.actionCodes, 'ActionCodes', 'json');
  }
  if (!$isNull(tmpReq.caseCodes)) {
    request.caseCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.caseCodes, 'CaseCodes', 'json');
  }
  if (!$isNull(tmpReq.eventCodes)) {
    request.eventCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.eventCodes, 'EventCodes', 'json');
  }
  if (!$isNull(tmpReq.punishStatus)) {
    request.punishStatusShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.punishStatus, 'PunishStatus', 'json');
  }
  if (!$isNull(tmpReq.sourceCodes)) {
    request.sourceCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sourceCodes, 'SourceCodes', 'json');
  }
  var query = {};
  if (!$isNull(request.actionCodesShrink)) {
    query['ActionCodes'] = request.actionCodesShrink;
  }
  if (!$isNull(request.aliUid)) {
    query['AliUid'] = request.aliUid;
  }
  if (!$isNull(request.bussinessCodes)) {
    query['BussinessCodes'] = request.bussinessCodes;
  }
  if (!$isNull(request.caseCodesShrink)) {
    query['CaseCodes'] = request.caseCodesShrink;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.eventCodesShrink)) {
    query['EventCodes'] = request.eventCodesShrink;
  }
  if (!$isNull(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!$isNull(request.page)) {
    query['Page'] = request.page;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.punishStatusShrink)) {
    query['PunishStatus'] = request.punishStatusShrink;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.sourceCodesShrink)) {
    query['SourceCodes'] = request.sourceCodesShrink;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!$isNull(request.url)) {
    query['Url'] = request.url;
  }
  if (!$isNull(request.urlFuzzy)) {
    query['UrlFuzzy'] = request.urlFuzzy;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SearchPunishRecords',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 管控事件查询
 *
 * @param request SearchPunishRecordsRequest
 * @return SearchPunishRecordsResponse
 */
async function searchPunishRecords(request: SearchPunishRecordsRequest): SearchPunishRecordsResponse {
  var runtime = new $RuntimeOptions{};
  return searchPunishRecordsWithOptions(request, runtime);
}

model SearchPunishRequestRequest {
  antiStatuses?: [ string ](name='AntiStatuses'),
  bussinessCodes?: [ string ](name='BussinessCodes'),
  class?: string(name='Class'),
  endDate?: long(name='EndDate'),
  eventCodes?: [ string ](name='EventCodes'),
  extRequestId?: string(name='ExtRequestId'),
  id?: long(name='Id'),
  idType?: string(name='IdType'),
  instanceId?: string(name='InstanceId'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
  punishDomain?: string(name='PunishDomain'),
  punishIp?: string(name='PunishIp'),
  punishStatuses?: [ string ](name='PunishStatuses'),
  punishUrl?: string(name='PunishUrl'),
  punishUrlFull?: string(name='PunishUrlFull'),
  sourceCodes?: [ string ](name='SourceCodes'),
  startDate?: long(name='StartDate'),
  userIds?: [ string ](name='UserIds'),
}

model SearchPunishRequestShrinkRequest {
  antiStatusesShrink?: string(name='AntiStatuses'),
  bussinessCodesShrink?: string(name='BussinessCodes'),
  class?: string(name='Class'),
  endDate?: long(name='EndDate'),
  eventCodesShrink?: string(name='EventCodes'),
  extRequestId?: string(name='ExtRequestId'),
  id?: long(name='Id'),
  idType?: string(name='IdType'),
  instanceId?: string(name='InstanceId'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
  punishDomain?: string(name='PunishDomain'),
  punishIp?: string(name='PunishIp'),
  punishStatusesShrink?: string(name='PunishStatuses'),
  punishUrl?: string(name='PunishUrl'),
  punishUrlFull?: string(name='PunishUrlFull'),
  sourceCodesShrink?: string(name='SourceCodes'),
  startDate?: long(name='StartDate'),
  userIdsShrink?: string(name='UserIds'),
}

model SearchPunishRequestResponseBody = {
  class?: string(name='Class'),
  code?: string(name='Code'),
  count?: long(name='Count'),
  dataList?: [ 
    {
      antiPunishRespTime?: string(name='AntiPunishRespTime'),
      antiPunishTime?: string(name='AntiPunishTime'),
      antiResult?: string(name='AntiResult'),
      antiStatus?: string(name='AntiStatus'),
      bussinessCode?: string(name='BussinessCode'),
      caseCode?: string(name='CaseCode'),
      caseExtendCode?: string(name='CaseExtendCode'),
      caseSubCode?: string(name='CaseSubCode'),
      class?: string(name='Class'),
      creator?: string(name='Creator'),
      deleted?: boolean(name='Deleted'),
      eventCode?: string(name='EventCode'),
      expectedRemoveTime?: string(name='ExpectedRemoveTime'),
      extRequestId?: string(name='ExtRequestId'),
      gmtCreated?: string(name='GmtCreated'),
      gmtModified?: string(name='GmtModified'),
      id?: long(name='Id'),
      idType?: string(name='IdType'),
      instanceId?: string(name='InstanceId'),
      ipString?: string(name='IpString'),
      modifier?: string(name='Modifier'),
      operator?: string(name='Operator'),
      operatorNum?: string(name='OperatorNum'),
      punishDomain?: string(name='PunishDomain'),
      punishIp?: string(name='PunishIp'),
      punishOfficer?: string(name='PunishOfficer'),
      punishOfficerNum?: string(name='PunishOfficerNum'),
      punishRequest?: string(name='PunishRequest'),
      punishRespTime?: string(name='PunishRespTime'),
      punishResult?: string(name='PunishResult'),
      punishStatus?: string(name='PunishStatus'),
      punishTime?: string(name='PunishTime'),
      punishUrl?: string(name='PunishUrl'),
      reason?: string(name='Reason'),
      sourceCode?: string(name='SourceCode'),
      userId?: string(name='UserId'),
    }
  ](name='DataList'),
  message?: string(name='Message'),
  success?: boolean(name='Success'),
  totalCount?: long(name='TotalCount'),
  viewCount?: long(name='ViewCount'),
}

model SearchPunishRequestResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SearchPunishRequestResponseBody(name='body'),
}

/**
 * @summary 处罚记录查询
 *
 * @param tmpReq SearchPunishRequestRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SearchPunishRequestResponse
 */
async function searchPunishRequestWithOptions(tmpReq: SearchPunishRequestRequest, runtime: $RuntimeOptions): SearchPunishRequestResponse {
  tmpReq.validate();
  var request = new SearchPunishRequestShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.antiStatuses)) {
    request.antiStatusesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.antiStatuses, 'AntiStatuses', 'json');
  }
  if (!$isNull(tmpReq.bussinessCodes)) {
    request.bussinessCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.bussinessCodes, 'BussinessCodes', 'json');
  }
  if (!$isNull(tmpReq.eventCodes)) {
    request.eventCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.eventCodes, 'EventCodes', 'json');
  }
  if (!$isNull(tmpReq.punishStatuses)) {
    request.punishStatusesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.punishStatuses, 'PunishStatuses', 'json');
  }
  if (!$isNull(tmpReq.sourceCodes)) {
    request.sourceCodesShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.sourceCodes, 'SourceCodes', 'json');
  }
  if (!$isNull(tmpReq.userIds)) {
    request.userIdsShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.userIds, 'UserIds', 'json');
  }
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SearchPunishRequest',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 处罚记录查询
 *
 * @param request SearchPunishRequestRequest
 * @return SearchPunishRequestResponse
 */
async function searchPunishRequest(request: SearchPunishRequestRequest): SearchPunishRequestResponse {
  var runtime = new $RuntimeOptions{};
  return searchPunishRequestWithOptions(request, runtime);
}

model UpdateSecurityEventStatusRequest {
  aliUid?: string(name='AliUid'),
  eventId?: string(name='EventId'),
  status?: string(name='Status'),
  callerParentId?: long(name='callerParentId'),
  callerType?: string(name='callerType'),
  callerUid?: long(name='callerUid'),
}

model UpdateSecurityEventStatusResponseBody = {
  code?: string(name='Code'),
  data?: any(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
  success?: boolean(name='Success'),
}

model UpdateSecurityEventStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateSecurityEventStatusResponseBody(name='body'),
}

/**
 * @summary 更新安全事件状态
 *
 * @param request UpdateSecurityEventStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateSecurityEventStatusResponse
 */
async function updateSecurityEventStatusWithOptions(request: UpdateSecurityEventStatusRequest, runtime: $RuntimeOptions): UpdateSecurityEventStatusResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UpdateSecurityEventStatus',
    version = '2022-08-22',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 更新安全事件状态
 *
 * @param request UpdateSecurityEventStatusRequest
 * @return UpdateSecurityEventStatusResponse
 */
async function updateSecurityEventStatus(request: UpdateSecurityEventStatusRequest): UpdateSecurityEventStatusResponse {
  var runtime = new $RuntimeOptions{};
  return updateSecurityEventStatusWithOptions(request, runtime);
}

